using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;

namespace DServer;

public partial class AboutDialog : Window
{
    public AboutDialog()
    {
        InitializeComponent();
        DataContext = this;
    }

    // 修复IDE0028：简化集合初始化
    public ObservableCollection<string> ComponentVersions { get; } =
    [
        "• Nginx: 1.25.3",
        "• MySQL: 8.0.35",
        "• PHP: 8.2.13",
        "• Redis: 7.2.1"
    ];

    // 修复CS1061：添加正确的事件处理方法
    private void CloseButton_Click(object sender, RoutedEventArgs e)
    {
        Close();
    }

    // 修复CS1061：重命名网站按钮事件处理方法
    private void WebsiteButton_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            Process.Start(new ProcessStartInfo
            {
                FileName = "https://www.iklfy.com",
                UseShellExecute = true
            });
        }
        catch (Exception ex)
        {
            MessageBox.Show($"无法打开网站: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
        }
    }
}